/**
 * 
 */
package org.istt.web;

import org.istt.service.FileManager;
import org.springframework.beans.factory.annotation.Autowired;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

/**
 * @author Huy
 *
 */
public class RemoveFileAction extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1076983559797360893L;
	private String[] ids;
	private FileManager fileManager;
	private String fieldId;
	private String cateId;
	private String fileStatusId;
	private String fromDate;
	private String toDate;
	private String fileId;
	private String sender;
	
	@Autowired
	public void setFileManager(FileManager fileManager) {
		this.fileManager = fileManager;
	}

	public String[] getIds() {
		return ids;
	}

	public void setIds(String[] ids) {
		this.ids = ids;
	}
	
	public String getFieldId() {
		return fieldId;
	}

	public void setFieldId(String fieldId) {
		this.fieldId = fieldId;
	}

	public String getCateId() {
		return cateId;
	}

	public void setCateId(String cateId) {
		this.cateId = cateId;
	}

	public String getFileStatusId() {
		return fileStatusId;
	}

	public void setFileStatusId(String fileStatusId) {
		this.fileStatusId = fileStatusId;
	}

	public String getFromDate() {
		return fromDate;
	}

	public void setFromDate(String fromDate) {
		this.fromDate = fromDate;
	}

	public String getToDate() {
		return toDate;
	}

	public void setToDate(String toDate) {
		this.toDate = toDate;
	}

	public String getFileId() {
		return fileId;
	}

	public void setFileId(String fileId) {
		this.fileId = fileId;
	}

	public String getSender() {
		return sender;
	}

	public void setSender(String sender) {
		this.sender = sender;
	}

	/**
	 * Struts action responsible for deleting files from database
	 * @return "success"
	 */
	public String remove() {
		fileManager.remove(ids);
		ActionContext.getContext().getSession().put("message", getText("files.deleted"));
		return SUCCESS;
	}
}
